<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>商品管理 - 今日特卖</title>

<?php include($this->c['_homes']['_viewsHome'].'/_global/_head.php');?>
</head>
<!-- BEGIN BODY -->
<body class="page-header-fixed page-sidebar-fixed">
<!-- BEGIN HEADER -->
<?php include($this->c['_homes']['_viewsHome'].'/_global/head.php');?>
<!-- END HEADER -->
<div class="clearfix"></div>
<!-- BEGIN CONTAINER -->
<div class="page-container" > 
  <!-- BEGIN HORIZONTAL MENU PAGE SIDEBAR1 -->
  <?php include($this->c['_homes']['_viewsHome'].'/_global/menu.php');?>
  <!-- END BEGIN HORIZONTAL MENU PAGE SIDEBAR --> 
  <!-- BEGIN PAGE -->
  <div class="page-content"> 
    <!-- BEGIN PAGE HEADER-->
    <div class="row">
      <div class="col-md-12"> 
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title"> 广告列表 </h3>
        <ul class="page-breadcrumb breadcrumb">
        	<?php
			if($this->pv['add']){?>
          <li class="btn-group">
            <button type="button" class="btn blue dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true"> <span>操作</span> <i class="icon-angle-down"></i> </button>
            <ul class="dropdown-menu pull-right" role="menu">             
              <li><a href="/channel/special_add"><i class="icon-plus"></i> 新增今日特卖</a></li>
            </ul>
          </li>
          <?
			}
			?>
          <li> <i class="icon-home"></i> <a href="/manage">后台</a> <i class="icon-angle-right"></i> </li>
          <li> 广告管理 <i class="icon-angle-right"></i> </li>
          <li>广告列表</li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB--> 
      </div>
    </div>
    <!-- END PAGE HEADER--> 
    <!-- BEGIN PAGE CONTENT-->
    
    <div class="row">
      <div class="col-md-12"> 
       <div class="portlet box">
          <div class="booking-search">
          <form action="" role="form" method="get">
              <div class="row form-group">

                  <div class="col-md-5" id="data_5">
                      <div class="input-group">
                          <input autocomplete="off" type="text" class="input-sm form-control" id="start_time" name="start_time" placeholder="开始时间" value="<?=isset($this->data['para']['start_time']) ? $this->data['para']['start_time'] : ''?>">
                          <span class="input-group-addon">到</span>
                          <input autocomplete="off" type="text" class="input-sm form-control" id="end_time" name="end_time" placeholder="结束时间" value="<?=isset($this->data['para']['end_time']) ? $this->data['para']['end_time'] : ''?>">
                      </div>
                  </div>
                <div class="col-md-1"><input type="submit" class="btn blue btn-block" value="搜 索"></div>

                </form>
          </div>
        </div>
        <!-- BEGIN SAMPLE TABLE PORTLET-->                  
        <div class="portlet box blue">
          <div class="portlet-title">
            <div class="caption"><i class="icon-list"></i>列表(<?=$this->data['count'];?>)</div>
            <div class="tools"> <a href="javascript:;" class="collapse"></a> </div>
          </div>
          <div class="portlet-body">
            <div class="table-scrollable">
             <table class="table table-striped table-bordered table-hover dataTable">
              <thead>
                <tr>
                  <th>ID</th>
                  <th>开始时间</th>
                  <th>结束时间</th>
                  <th>创建时间</th>
                  <th>操作</th>
                </tr>
              </thead>
 <tbody>
              <?php
			if($this->data['data'])
			{
				foreach($this->data['data'] as $k=> $r){										
																
			?>
                <tr>
                  <td><?=$r['id'];?></td>
                  <td><?=date("Y-m-d H:i",$r['start_time']);?></td>
                   <td><?=date("Y-m-d H:i",$r['end_time']);?></td>
                  <td><?=date("Y-m-d H:i:s",$r['create_time']);?></td>
                  <td>
      <?php
          //if($this->pv['stock']) echo ' <a href="stock?goods_id='.$r['goods_id'].'" class="btn btn-xs blue"><i class="icon-truck"></i> 库存</a>';
          if($this->pv['edit']) echo ' <a href="/channel/special_edit?id='.$r['id'].'" class="btn btn-xs blue"><i class="icon-edit"></i> 编辑</a>';
          if($this->pv['del']) echo ' <a href="#portlet-config" data-toggle="modal" onclick="_delete_alert('.$r['id'].');" class="btn btn-xs red"><i class="icon-remove"></i> 删除</a>';
      ?></td>
                </tr>
                <?
					}
				}
				?>
				 </tbody>                                
            </table>
            </div>
          </div>
        </div>
        <?php
		if($this->data['maxpage'] > 1){
		?>
        <div>
          <ul class="pagination">
            <?
			$pquery="?";		
			if($this->data['para']){			
				foreach($this->data['para'] as $k=>$r){				
					$pquery.=$k."=".$r."&";
          $form_hidden .= '<input type="hidden" name="'.$k.'" value="'.$r.'">';
				}			
			}
			
			if($this->data['page'] > 1) echo '<li><a href="'.$pquery.'page='.($this->data['page']-1).'"><i class="icon-angle-left"></i></a></li>';
			for($i = $this->data['spage']['ps']; $i<=$this->data['spage']['pe']; $i++){
			if($i == $this->data['page']) echo '<li class="disabled"><a href="javascript:void(0);">'.$i.'</a></li>';
			else echo '<li><a href="'.$pquery.'page='.$i.'">'.$i.'</a></li>';
			}
			
			if($this->data['page'] < $this->data['maxpage']) echo '<li><a href="'.$pquery.'page='.($this->data['page']+1).'"><i class="icon-angle-right"></i></a></li>';
			?>
          </ul>
                   <div class="jumppage">
          <form method="get" action="">
          <?=$form_hidden;?>
          页码：<?=$this->data['page'];?>/<?=$this->data['maxpage'];?>
          跳到 <input type="text" name="page" class="value"> 页          
          <input type="submit" value="GO" class="sub">
          </form>
          </div>
        </div>
        <?
 		}
?>
        <!-- END SAMPLE TABLE PORTLET--> 
      </div>
    </div>
    <!-- END PAGE CONTENT--> 
  </div>
  <!-- END PAGE --> 
</div>

    <!-- /.modal --> 
<?php include($this->c['_homes']['_viewsHome'].'/_global/_footer.php');?>
<script src="/style/js/layer/laydate.js" type="text/javascript"></script>
<script src="/style/js/layer/layer.min.js" type="text/javascript"></script>
<script>
		jQuery(document).ready(function() {
            App.init();
            laydate.render({
                elem: '#start_time'
                , type: 'datetime',

            });

            laydate.render({
                elem: '#end_time'
                , type: 'datetime'

            });

        })

function _delete_alert(id){

    layer.confirm("您确定要删除此特卖吗", function(){
        $.post("/channel/ajax",{"act":"special_del","id":parseInt(id),"mr":Math.random()},function(data){


        if(data.code==200){
            layer.msg(data.msg);
            setTimeout(function(){
                location.reload();
            },1500);

    }else{
            layer.msg('['+data.code+']'+data.msg);
    }
    },'json');
});


}

	</script> 

<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>